package com.hl.qzzpbackend.model.enums;
import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * 学校类型枚举
 * @author helong
 */
@Getter
public enum SchoolTypeEnum {

    FULL_TIME(0,"全日制"),
    PART_TIME(1,"非全日制"),
    OTHER(2,"其他");


    private final Integer value;
    private final String text;

    // 构造函数
    SchoolTypeEnum(Integer value, String text) {
        this.value = value;
        this.text = text;
    }


    /**
     * 根据value获取枚举
     * @param value 枚举值的value
     * @return 枚举值
     */
    public static SchoolTypeEnum getEnumByValue(Integer value) {
        if(ObjUtil.isEmpty(value)) {
            return null;
        }
        for (SchoolTypeEnum schoolTypeEnum : SchoolTypeEnum.values()) {
            if (schoolTypeEnum.getValue().equals(value)) {
                return schoolTypeEnum;
            }
        }
        return null;
    }
}